﻿message(STATUS "Enter yhtc folder")

project(yht VERSION 0.2.1)

FIND_PACKAGE(Qt5Core)
FIND_PACKAGE(Qt5Network)
FIND_PACKAGE(Qt5Sql)
FIND_PACKAGE(Qt5SerialPort)

configure_file(version.h.in "${PROJECT_SOURCE_DIR}/version.h")


set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -utf-8") 
set(CMAKE_CXX_STANDARD 17)

set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)

aux_source_directory(. SRC_LIST)
aux_source_directory(./model/ SRC1) 
aux_source_directory(./update/ SRC2) 


# 子目录 静态库方式
include_directories(${CMAKE_SOURCE_DIR}/ThirdParty/geographiclib)
include_directories(${CMAKE_SOURCE_DIR}/ThirdParty/spdlog)
include_directories(${CMAKE_SOURCE_DIR}/ThirdParty/quazip)
include_directories(${CMAKE_SOURCE_DIR}/ThirdParty/quazip/quazip/zlib)
include_directories(${CMAKE_SOURCE_DIR}/CommonUtils)
include_directories(${CMAKE_SOURCE_DIR}/IEC61162)

if(TARGETPATFORM MATCHES "arm")
    message(STATUS "Detected ARM architecture")
    LINK_DIRECTORIES(${ARMPATHLIB})
endif()


LINK_DIRECTORIES(${PROJECT_BINARY_DIR}/lib)						# 添加lib目录为静态库目录
message("Qt installation directory: ${Qt5_DIR}")
LINK_DIRECTORIES(${Qt5_DIR}/../../)
set(LIBS CommonUtils IEC61162 GeographicLib spdlog quazip)
#WIN32参数可以隐藏启动时的console窗口
add_executable(${PROJECT_NAME} ${SRC_LIST} ${SRC1} ${SRC2} ) 
target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Core Qt5::Network Qt5::Sql Qt5::SerialPort)
target_link_libraries(${PROJECT_NAME} PRIVATE ${LIBS})
